package FMainController;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * Servlet implementation class MYoungAction
 */
public class MYoungAction extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public MYoungAction() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
		request.setCharacterEncoding("UTF-8");
 		response.setCharacterEncoding("UTF-8");
 		response.setContentType("text/html; charset=UTF-8");
 		RequestDispatcher view = null;
 		
 		MYoungActionDAO myoungactiondao = new MYoungActionDAO();
 		MYoungActionBean[] myoungactionbean = null;
 		MYoungActionBean[] myoungactionbean2 = null;
 		
 		String[] oldphoto = myoungactiondao.oldPhoto();
 		String[] babyphoto = myoungactiondao.babyPhoto();
 		myoungactionbean = myoungactiondao.bulletinData();
 		myoungactionbean2 = myoungactiondao.photoData();
 		
 		request.setAttribute("oldphoto", oldphoto);
 		request.setAttribute("babyphoto", babyphoto);
 		request.setAttribute("bulletindata", myoungactionbean);
 		request.setAttribute("photodata", myoungactionbean2);
		view = request.getRequestDispatcher("/Main/YoungMain/Ym_Main.jsp");
		view.forward(request, response);
 		
	}

}
